import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
export default new Vuex.Store({
  state: {
    name: "sss",
    age: '18',
    num: 1
  },
  getters: {
    getAge: state => {
      return state.age;
    }
  },
  mutations: {
    changeNum: (state, value) => {
      state.num += value;
    }
  },
  actions: {
    changeNumAsync: (context, value) => {
      setTimeout(function () {
        context.commit('changeNum', value);
      }, 1000)
    }
  }
});
